# -*- coding: utf-8 -*-

from functools import wraps
from toolFunctions import response


def check_login(f):
    @wraps(f)
    def inner(request, *arg, **kwargs):
        if request.session.get('is_login') == '1':
            return f(request, *arg, **kwargs)
        else:
            return response.fail('NOT_LOGIN')

    return inner